Skip to content

add single-argument (de)serialize methods operating on vectors of bytes#60315

Open
aplavin wants to merge 3 commits intoJuliaLang:masterfrom
aplavin:patch-22
Open

add single-argument (de)serialize methods operating on vectors of bytes#60315
aplavin wants to merge 3 commits intoJuliaLang:masterfrom
aplavin:patch-22

Conversation

@aplavin
Copy link
Copy Markdown
Contributor

@aplavin aplavin commented Dec 4, 2025

Basically, for convenience: I find myself copy-pasting these methods whenever I load/store Julia serialized data as part of another data format like parquet or sql database. They natively store byte arrays, and would be nice to have these (de)serialize methods going directly back and forth between Julia objects and byte vectors.

Another neat usecase is to quickly copy-paste a Julia object between different Julia sessions (repls, notebooks, remote, ...):

# in session 1:
x |> serialize |> base64encode
# copy the resulting string

# in session 2:
x = "<paste string here>" |> base64decode |> deserialize

@JeffBezanson
Copy link
Copy Markdown
Member

Looks good. Would be nice to add doc strings to these.

Copy link
Copy Markdown
Member

@LilithHafner LilithHafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I've also wanted this functionality. There's no other plausible implementation of the deserialize(::Vector{UInt8}) method, and the return type Vector{UInt8} seems reasonable for the serialize(value) method.

Should go to triage as it is technically an expansion of public API? The specific question I'd ask is: "Is Vector{UInt8} the right return type for serialize(value)?"

@JeffBezanson
Copy link
Copy Markdown
Member

I think we can just merge this. What is the mac build failure here about?

@adienes
Copy link
Copy Markdown
Member

adienes commented Dec 12, 2025

is there a reason the docs enforce specifically a Vector{UInt8} from serialize rather than an iterator over UInt8 ? it's quite rare one needs indexed access to serialized data, right?

for deserialize it makes sense to not promise more than is implemented, but I don't think these need to be perfectly symmetric


See [`deserialize(::IO)`](@ref deserialize(::IO)) for more details and caveats.

!!! compat "Julia 1.13"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!!! compat "Julia 1.13"
!!! compat "Julia 1.14"

See [`deserialize(::IO)`](@ref deserialize(::IO)) for more details and caveats.

!!! compat "Julia 1.13"
This method is available as of Julia 1.13.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This method is available as of Julia 1.13.
This method is available as of Julia 1.14.

@DilumAluthge
Copy link
Copy Markdown
Member

@aplavin Can you update the compat notes to 1.14, as suggested by @adienes? Also, can you rebase on the latest Julia master?

Once the above two tasks are done, and once CI is green, @JeffBezanson @LilithHafner can I merge this?

@LilithHafner LilithHafner added the triage This should be discussed on a triage call label Jan 31, 2026
@LilithHafner
Copy link
Copy Markdown
Member

I think triage should talk briefly about API just to confirm. e.g. we should talk about #60315 (comment)

@JeffBezanson
Copy link
Copy Markdown
Member

From triage: we think it's fine to use Vector{UInt8}, no need to overthink it. PR approved.

@JeffBezanson JeffBezanson removed triage This should be discussed on a triage call status: waiting for triage feedback labels Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants